package com.itheima.test02.config;

import com.itheima.test02.dao.IUserDao;
import com.itheima.test02.dao.UserDao;
import com.itheima.test02.service.IUserService;
import com.itheima.test02.service.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

//@Configuration  // 相当xml配置
//@ComponentScan("com.itheima.test02")  // <context:component-scan
//@Import(UserService.class)
public class SpringConfig {
    @Bean
    public IUserService userService() {
//        IUserDao iUserDao = User();
        return new UserService();
    }

//    @Bean
//    public IUserDao User() {
//        System.out.println("UserDao");
//        return new UserDao();
//    }
}
